package com.nkzy.mapper;

import com.nkzy.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {
    @Select("select * from user where username=#{username}")
    User selectUserByName(String username);
    @Insert("insert into user(username,password,create_time,update_time) values(#{username},#{password},now(),now())")
    void insert(String username,String password);
    //根据id查用户
    @Select("select * from user where Id=#{Id}")
    User selectUserById(Integer Id);
    //查询所有用户的方法，然后进行单元测试
    @Select("select * from user ")
    User selectUser();
    //修改一个用户姓名的方法，然后进行单元测试
    @Update("update 'username' set username='#{username}' where '#{id}'")
    User updateUsernameByID(Integer id,String username);

}
